package com.riant.day04.demo1;

import java.util.concurrent.ExecutionException;

/**
 * @Classname Test01
 * @Description TODO
 * @Date 2021/3/10 15:00
 * @Created by 张斌
 */
public class Test01 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyThread myThread=new MyThread();
        //myThread.start();
        System.out.println("myThread tid:" +myThread.getId());
        Thread thread2 = new Thread("abc");
        System.out.println("myThread tid:" +thread2.getId()+",thread name:"+thread2.getName());
        System.out.println(thread2.toString());
        ThreadGroup threadGroup=thread2.getThreadGroup();
        System.out.println(threadGroup.getName());
//        MyRunnable myRunnable = new MyRunnable();
//        Thread thread = new Thread(myRunnable);
//        thread.start();
//        MyCallable myCallable=new MyCallable();
//        ExecutorService executorService= Executors.newSingleThreadExecutor();
//        Future<Integer> future=executorService.submit(myCallable);
//
//        for(int j=0;j<=10;j++){
//            System.out.println("当前线程名："+Thread.currentThread().getName() +",j="+j);
//        }
//        //future.cancel(true);
//        System.out.println(future.get());
//        executorService.shutdown();
    }
}
